# coding:utf-8

from pymongo import MongoClient


class ProcessPoetry:

    def __init__(self):
        self.client = MongoClient('127.0.0.1:27017')
        self.db = self.client['moose']

    def process(self):
        # result = self.db['poetry_category'].find()
        # for item in result:
        # self.db['poetry_category'].update_many({"_id": item['_id']}, {"$set": {"poetry_num": int(item['poetry_num'])}})
        # item['poetry_author_name'] = item['poetry_author']
        # self.db['poetry_category'].insert_one(item)
        # print(type(item))
        # print(item)
        # self.db['poetry_category'].update_many({"_id": item['_id']}, {"$set": item})
        pass

    def rename(self):
        self.db['poetry_category'].update({}, {"$unset": {"poetry_author": 1}}, {"multi": True})


process_poetry = ProcessPoetry()
process_poetry.rename()
